-
Notifications
You must be signed in to change notification settings - Fork 11
feat: Add support for FDv1 fallback. #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…/java-core into rlamb/fallback-and-recovery
This comment was marked as outdated.
This comment was marked as outdated.
lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/FDv2DataSystem.java
Show resolved
Hide resolved
lib/sdk/server/src/test/java/com/launchdarkly/sdk/server/FDv2DataSourceTest.java
Outdated
Show resolved
Hide resolved
lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/DataSourceSynchronizerAdapter.java
Show resolved
Hide resolved
This comment was marked as outdated.
This comment was marked as outdated.
|
bugbot review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a rename and a refactory, but not actually net-new. Basically I moved the initializers and the synchronizers to be managed by this, and to be iterator like.
So getting the next one handles all the shutdown conditions, setting it active, etc.
So a consumer just calls getNext until it returns null.
| private void runInitializers() { | ||
| boolean anyDataReceived = false; | ||
| for (DataSourceFactory<Initializer> factory : initializers) { | ||
| Initializer initializer = sourceManager.getNextInitializerAndSetActive(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the initializers into the source manager so that shutdown and behavior was uniform. Basically iterate until you are out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay empty file.
| ); | ||
| result = FDv2SourceResult.interrupted(internalError, getFallback(event)); | ||
| restartStream(); | ||
| if(kind == DataSourceStatusProvider.ErrorKind.INVALID_DATA) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the change for the other failing contract tests. This may be overly broad still. As MISSING_PAYLOAD is also in the category and not just JSON_ERROR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| if (fallbackSynchronizer.polling != null && | ||
| fallbackSynchronizer.polling.baseUri != null) { | ||
| endpoints.polling(fallbackSynchronizer.polling.baseUri); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing streaming baseUri for FDv1 polling fallback
Medium Severity
When a streaming synchronizer is selected as the FDv1 fallback source (lines 646-650), its custom streaming.baseUri is not used to configure the global polling endpoint. The code only checks fallbackSynchronizer.polling which will be null for streaming synchronizers, causing the FDv1 polling fallback to use default endpoints instead of the custom environment's endpoints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I care.
BEGIN_COMMIT_OVERRIDE
chore: Add support for FDv1 fallback.
chore: Implement FDv2 Data Source Status.
chore: Extend FDv2 Data source logging.
END_COMMIT_OVERRIDE
I would like to still add more detail to logging, but I added the basics in this PR.
Note
Medium Risk
Touches core data acquisition/failover behavior (FDv2 synchronizer selection, fallback to FDv1, and status transitions), so regressions could impact initialization and live flag updates despite good test coverage.
Overview
Adds FDv1 fallback support for FDv2 data systems: the contract-test harness can now configure an FDv1 polling fallback, and
FDv2DataSystemcan wrap an FDv1DataSourceas an FDv2Synchronizervia the newDataSourceSynchronizerAdapter.Refactors FDv2 source selection by replacing
SynchronizerStateManagerwith a newSourceManager, and updatesFDv2DataSourceto properly trigger/lock in FDv1 fallback when requested, emit clearerDataSourceStatusProviderupdates (VALID/INTERRUPTED/OFF) including on exhaustion/close, and add basic logging around fallback/recovery and errors. Contract-test suppression for “fallback to FDv1 handling” is removed and extensive unit tests are added/updated accordingly.Written by Cursor Bugbot for commit beb300c. This will update automatically on new commits. Configure here.